home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- '''Fixer for exec.
-
- This converts usages of the exec statement into calls to a built-in
- exec() function.
-
- exec code in ns1, ns2 -> exec(code, ns1, ns2)
- '''
- from import pytree
- from import fixer_base
- from fixer_util import Comma, Name, Call
-
- class FixExec(fixer_base.BaseFix):
- PATTERN = "\n exec_stmt< 'exec' a=any 'in' b=any [',' c=any] >\n |\n exec_stmt< 'exec' (not atom<'(' [any] ')'>) a=any >\n "
-
- def transform(self, node, results):
- if not results:
- raise AssertionError
- syms = self.syms
- a = results['a']
- b = results.get('b')
- c = results.get('c')
- args = [
- a.clone()]
- args[0].set_prefix('')
- if b is not None:
- args.extend([
- Comma(),
- b.clone()])
-
- if c is not None:
- args.extend([
- Comma(),
- c.clone()])
-
- return Call(Name('exec'), args, prefix = node.get_prefix())
-
-
-